﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.Web.UI
{
    public class ZWPage : ZPage
    {
        protected override void OnInit()
        {
            base.OnInit();
            SetCache();


        }

        protected virtual void SetCache()
        {
            if (ZConfig.IsUseCache)
            {
                this.SetOutCache();
            }
        }

        protected virtual void SetOutCache()
        {
            int cacheTime = ZConfig.CacheTime;
            Response.Cache.SetExpires(DateTime.Now.AddSeconds(cacheTime));
            Response.Cache.SetValidUntilExpires(true);
            Response.Cache.SetCacheability(HttpCacheability.Public);
            Response.Cache.VaryByParams["page"] = true;
            Response.Cache.VaryByParams["id"] = true;
            Response.Cache.VaryByParams["Type"] = true;
            Response.Cache.VaryByParams["NewsClass_ID"] = true;

        }
    }
}
